﻿using AutoMapper;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Process.API.Application.Command.Action.Report;
using Process.API.Application.Command.Show;
using Process.Domain;
using Process.ErrorCode;

namespace Process.API.Controllers
{
    /// <summary>
    /// 报表
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReportController : ControllerBase
    {
        IMediator mediator;

        public ReportController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 报表记录显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<APIPaging<List<ReportTable>>>> ReportCommand([FromQuery]ReportCommand request)
        {
            
            return await mediator.Send(request);

        }
        /// <summary>
        /// 报表记录新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AddReportCommand(AddReportCommand request)
        {

            return await mediator.Send(request);
        }
        /// <summary>
        /// 报表记录删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<int>> DelReportCommand([FromQuery]DelReportCommand request)
        {
            return await mediator.Send(request);

        }
        /// <summary>
        /// 报表记录修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdReportCommand(UpdReportCommand request)
        {
            return await mediator.Send(request);
        }

    }
}
